﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MobileBG
{
    public class Producer
    {
        private string name;
        private List<CarModel> models;

        public Producer(string name, List<CarModel> models)
        {
            this.models = new List<CarModel>();
            this.Models = models; 
            this.Name = name;
        }

        public string Name
        {
            get
            {
                return this.name;
            }
            private set
            {
                if (value != null && value != this.name)
                {
                    this.name = value;
                }
            }
        }

        public List<CarModel> Models
        {
            get
            {
                return models;
            }
            set
            {
                if (value != null)
                {
                    foreach (var model in value)
                    {
                        this.models.Add(model);
                    }
                }
            }
        }
    }
}